﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AntiObesity.DatabaseAccess;

namespace AntiObesity.Base.Managers
{
    public static partial class SubcategoryManager
    {
        public static List<Subcategory> FindByName(string name)
        {
            var result = new List<Subcategory>();
            using (var conn = DB.Instance.Current.GetConnection())
            {
                var reader = DB.Instance.Current.ExecuteForReader(conn,
                    String.Format("SELECT * FROM [Subcategories] WHERE [Name]='{0}'", name));
                while (reader.Read())
                {
                    result.Add(CreateSubcategory(reader));
                }
            }
            return result;
        }

    }
}
